﻿using System.Text;

namespace CodeContrib
{
	public class RandomIpAddress : IRandom<string>
	{
		public string Next()
		{
			var randomFirstSegment = new RandomInteger(1, 2);
			var randomSegment = new RandomInteger(0, 255);

			var ipAddress = new StringBuilder();
			ipAddress.Append(randomFirstSegment.Next());

			for (var i = 0; i < 3; i++)
			{
				ipAddress.Append(".");
				ipAddress.Append(randomSegment.Next());
			}

			return ipAddress.ToString();
		}
	}
}